﻿function IdiomaVaga() {
    this.VagaId = 0;
    this.IdiomaId = 0;
    this.Nivel = 0;

    this.Salvar = function (callback) {
        var json = JSON.stringify({
            idioma: {
                IdiomaId: this.IdiomaId,
                Nivel: this.Nivel
            },
            vagaId: this.VagaId 
        });
        $.ajax({
            url: eS.UrlPadrao + 'Views/Cadastros/Vaga.aspx/AddIdiomaVaga',
            type: "post",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: json,
            success: function (e) {
                callback(e, true);
            },
            error: function (e) {
                callback(e, false);
            }
        });
    }
    this.Excluir = function (callback) {
        var json = JSON.stringify({ IdiomaId: this.IdiomaId, Nivel: this.Nivel });
            $.ajax({
            url: eS.UrlPadrao + 'Views/Cadastros/Vaga.aspx/RemoveIdiomaVaga',
            type: "post",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: "{ idioma: " + json + ", vagaId: " + this.VagaId + "}",
            success: function (e) {
                callback(e, true);
            },
            error: function (e) {
                callback(e, false);
            }
        });
    }
}